<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 1000px;
            height: 1000px;
        }
    </style>
</head>
<body>
    <div class="box"></div>
    <script src="/js/echarts.min.js"></script>
    <script>
        var myChart = echarts.init(document.querySelector(".box"));
        var option = {
            //可以设置线条的颜色，注意后面是个数组
            color: ['green', 'blue', 'yellow', 'black', 'pink'],
            //设置图标的标题
            title: {
                text: 'Stacked Line'
            },
            //图表的提示框组件
            tooltip: {
                // 触发方式
                trigger: 'axis'
            },
            // 图例组件
            legend: {
                // 若series里每一项有name值，则此处data可以删去
                // data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
            },
            //可以控制图表的大小
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                //是否显示刻度标签
                containLabel: true
            },
            // 工具箱组件 (可以另存为图片等功能)
            toolbox: {
                feature: {
                    saveAsImage: {}
                }
            },
            //设置x轴相关配置
            xAxis: {
                type: 'category',
                // 让我们的线条和坐标轴有缝隙
                boundaryGap: false,
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
                type: 'value'
            },
            //系列图表配置 它决定使用哪种列表
            series: [{
                    name: 'Email',
                    type: 'line',

                    data: [120, 132, 101, 134, 90, 230, 210]
                },
                {
                    name: 'Union Ads',
                    type: 'line',

                    data: [220, 182, 191, 234, 290, 330, 310]
                },
                {
                    name: 'Video Ads',
                    type: 'line',

                    data: [150, 232, 201, 154, 190, 330, 410]
                },
                {
                    name: 'Direct',
                    type: 'line',

                    data: [320, 332, 301, 334, 390, 330, 320]
                },
                {
                    name: 'Search Engine',
                    type: 'line',

                    data: [820, 932, 901, 934, 1290, 1330, 1320]
                }
            ]
        };
        myChart.setOption(option);
    </script>
</body>

</html>